@mixin absolute-fill($pseudo: false) {
	@if ($pseudo) {
		content: "";
	}

	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
}
@mixin border-radius($top: 0, $bottom: 0) {
	border-top-left-radius: $top;
	border-top-right-radius: $top;
	border-bottom-right-radius: $bottom;
	border-bottom-left-radius: $bottom;
}

$primary-color: #4c4d5e;
$primary-color-dark: darken($primary-color, 10%);
$primary-color-tint: lighten($primary-color, 10%);
$secondary-color: #68e8d7;
$secondary-color-dark: darken($secondary-color, 10%);
$secondary-color-tint: lighten($secondary-color, 10%);

:root {
	--black: #2a2a33;
	--white: #fff;
	--grey: #dedede;
	--primary-color: #{$primary-color};
	--primary-color-dark: #{$primary-color-dark};
	--primary-color-tint: #{$primary-color-tint};
	--secondary-color: #{$secondary-color};
	--secondary-color-rgba: rgba(104, 232, 215, 0.7);
	--secondary-color-dark: #{$secondary-color-dark};
	--secondary-color-tint: #{$secondary-color-tint};
	--background-color: #777891;
	--blush-color: #ff6ec7;
	--mouth-inner-color: #633440;
	--face-detail-color: var(--black);
	--choco: #4d4443;
	--choco-dark: #423c3b;
	--shadow-color: #707187;
}
* {
	box-sizing: border-box;
}
body {
	display: grid;
	place-items: center;
	height: 100vh;
	background-color: var(--background-color);
	font-size: 16px;
	line-height: 1;
}
.suppi{
    --eye-top-radius : 0;
    --eye-bottom-radius: 50% 75%;
	--eye-inner-top-radius: 0;
	--mouth-width: 0.75rem;
    --blush-scale: 1;
    position: relative;
    z-index: 2;
	display: flex;
	flex-direction: column;
    align-items: center;
    &::before {
		content: "";
		position: absolute;
		z-index: 0;
		bottom: 1.25rem;
		height: 2rem;
		width: 9rem;
		border-radius: 50%;
		background-color: var(--shadow-color);
    }
    &-head{
        position: relative;
		z-index: 10;
		height: 11.5rem;
        width: 12rem;
        &::before{
            content: "";
            position: absolute;
            z-index: -1;
			bottom: -0.5rem;
			left: 40%;
            height: 1rem;
			width: 20%;
			border-radius: 100%;
			background-color: var(--primary-color-dark);
        }
    }
    &-face{
        @include absolute-fill;
        @include border-radius(50% 55%, 50% 45%);
        z-index: 5;
		background-color: var(--primary-color);
    }
    &-eye{
        position: absolute;
		z-index: 3;
		top: 6rem;
		height: 2.5rem;
        width: 3.25rem;
        transform-origin: center 20%;
        background-color: var(--secondary-color);
        background-color: var(--secondary-color);
		border-top-left-radius: var(--eye-top-radius);
		border-top-right-radius: var(--eye-top-radius);
		border-bottom-left-radius: var(--eye-bottom-radius);
        border-bottom-right-radius: var(--eye-bottom-radius); 
        overflow: hidden;
        transition: var(
			--eye-transition,
			border-radius 0.2s ease-in-out,
			top,
			0.4s ease-in-out
		);
        &::before{
            content: "";
            position: absolute;
            top: 0;
			height: 70%;
            width: 0.75rem;
            border-top-left-radius: var(--eye-inner-top-radius);
            border-top-right-radius: var(--eye-inner-top-radius);
            border-bottom-left-radius: 0.75rem 2rem;
			border-bottom-right-radius: 0.75rem 2rem;
            background-color: var(--primary-color);
            transform: var(--eye-inner-transform, translateY(0));
            transition: var(--eye-inner-transition, 0.3s ease-in-out);
        }
        &-left {
			left: 1.125rem;

			&::before {
				right: 0.875rem;
			}
        }
        &-right {
			right: 1.125rem;

			&::before {
				left: 0.875rem;
			}
		}
    }
    &-nose{
        @include border-radius(50% 20%, 50% 80%);
        position: absolute;
		left: 50%;
		top: 7.5rem;
        height: 0.1875rem;
        width: 0.325rem;
        transform: translateX(-50%);
        background-color: var(--face-detail-color);
    }
    &-mouth{
        position: absolute;
        top: 8rem;
		left: 50%;
        height: 2.5rem + 0.625rem;
        width: var(--mouth-width);
        transform: translateX(-50%);
        overflow: hidden;
        transition: var(--mouth-transtion, width 0.3s 0.1s ease-in-out);
        &::before,
		&::after {
            content: "";
			position: absolute;
			height: 0.5rem;
			width: 1.125rem;
			border-radius: 100%;
			border-bottom: 2px solid var(--face-detail-color);
			background-color: var(--primary-color);
        }
        &::before {
			left: 50%;
        }
        &::after {
			right: 50%;
        }
        &-inner {
			position: absolute;
			z-index: -1;
			top: 0.25rem;
			left: calc(50% - 0.75rem);
			width: 1.5rem;
			height: 2.5rem;
			transform-origin: center top;
			transform: scaleY(0);
			background-color: var(--mouth-inner-color);
			border-bottom-left-radius: 50% 70%;
			border-bottom-right-radius: 50% 70%;
			overflow: hidden;
			transition: transform 0.1s ease-in-out;

			&::after {
				content: "";
				position: absolute;
				bottom: -0.5rem;
				left: 0.25rem;
				height: 2.25rem;
				width: 120%;
				border-radius: 100%;
				background-color: var(--blush-color);
			}
        }
    }
    &-blush{
        position: absolute;
		z-index: 1;
		top: 7.75rem;
		height: 1.25rem;
		width: 2.25rem;
		border-radius: 50%;
        background-color: var(--blush-color);
        opacity: var(--blush-opacity, 0.2);
        transition: var(
			--blush-transition,
			transform 0.4s ease-in-out,
			opacity 0.4s ease-in-out
		);
        &-left {
			left: 0.5rem;
			transform: rotate(5deg) scale(var(--blush-scale));
		}

		&-right {
			right: 0.5rem;
			transform: rotate(-5deg) scale(var(--blush-scale));
		}
    }
    &-ear{
        position: absolute;
		z-index: 1;
		top: 0rem;
		height: 6.5rem;
		width: 6rem;
		background-color: var(--primary-color);
        overflow: hidden;
        &::before {
			content: "";
			position: absolute;
			top: -1.5rem;
			height: 150%;
			width: 100%;
			border-radius: 100%;
			background-color: var(--secondary-color);
        }
        &-left{
            --ear-transform: 5deg;
            right: calc(100% - 3.25rem);
            transform-origin: bottom right;
			transform: rotate(var(--ear-transform));
			border-top-right-radius: 100% 10%;
            border-bottom-left-radius: 70% 90%;
            &::before {
				left: -3rem;
				transform: rotate(-60deg);
            }
           
        }
        &-right {
            --ear-transform: -5deg;

            left: calc(100% - 3.25rem);
            transform-origin: bottom left;
            transform: rotate(var(--ear-transform));
            border-top-left-radius: 100% 10%;
            border-bottom-right-radius: 70% 90%;

            &::before {
                right: -3rem;
                transform: rotate(60deg);
            }
        }
    }
    &-body{
        position: relative;
		z-index: 9;
		top: -3rem;
		height: 8rem;
		width: 6rem;
		perspective: 1000px;
    }
    &-torso{
        @include absolute-fill;
        transform: perspective(1rem) rotateX(2.5deg);
        border-bottom-left-radius: 2.25rem 2rem;
		border-bottom-right-radius: 2.25rem 2rem;
        background-color: var(--primary-color);
        overflow: hidden;
        &::before,
		&::after {
			content: "";
			position: absolute;
        }
        &::before {
			bottom: 0;
			left: 0;
			width: 100%;
			height: 35%;
			background-color: var(--primary-color-dark);
        }
        &::after {
			bottom: 2.5rem;
			left: 20%;
			border-radius: 100%;
			width: 60%;
			height: 3rem;
			background-color: var(--primary-color);
        }
        // wrapped for safari perspective issue
		&,
		&-wrap {
			@include absolute-fill;
			z-index: 3;
		}
    }
    &-wing{
        --wing-transform: rotate(20deg);
        z-index: 1;
		top: 2rem;
		height: 2rem;
		width: 6.5rem;
		transform-origin: 90% 50%;
        transform: var(--wing-transform);
        &,
		&::before {
			position: absolute;
			border-top-right-radius: 80% 50%;
			border-bottom-right-radius: 80% 50%;
			border-top-left-radius: 20% 50%;
			border-bottom-left-radius: 20% 50%;
			background-color: var(--secondary-color-rgba);
        }
        &::before {
			content: "";
			right: -0.5rem;
			top: 1.5rem;
			height: 1.5rem;
			width: 4rem;
			transform: rotate(-40deg);
        }
        &-left {
			right: calc(100% - 1rem);
        }
        &-right {
			--wing-transform: rotate(-20deg) rotateY(180deg);

			left: -0.25rem;
		}
    }
    &-arm{
        @include border-radius(50% 10%, 50% 30%);
		position: absolute;
		z-index: 4;
		top: 4.75rem;
		height: 5rem;
		width: 2rem;
		background-color: var(--primary-color);
		transform-origin: 50% 1rem;
        transition: transform 0.15s ease-in-out;
        &-paw {
			@include border-radius(50% 30%, 50% 30%);
			position: absolute;
			top: 1rem;
			height: 4rem;
			width: 100%;
			transform-origin: center 1rem;
			transform: rotate(var(--paw-rotate, 0deg));
			background-color: inherit;
			transition: 0.4s ease-in-out;
        }
        &-left {
			z-index: 5;
			left: 0;
			transform: rotate(-10deg) translateY(var(--arm-left-translate, 0));
			height: 3rem;
        }
        &-right {
			right: 0;
			transform: rotate(10deg);
		}

    }
    &-foot {
		position: absolute;
		z-index: 2;
		bottom: 0;
		width: 4.5rem;
		height: 1.5rem;
		background-color: var(--primary-color-dark);
	}
    &-leg{
        position: absolute;
		z-index: 1;
		bottom: -1rem;
		height: 5rem;
        width: 3.5rem;
        &-upper{
            @include absolute-fill;

			z-index: 1;
			border-radius: 50%;
			background-color: var(--primary-color-dark);
            overflow: hidden;
            &::after {
				content: "";
				position: absolute;
				top: -2.5rem;
				height: 100%;
				width: 120%;
				border-radius: 50%;
				background-color: var(--primary-color);
            }
        }
        &-left{
            right: calc(100% - 2rem);
            .suppi-leg-upper {
				&::after {
					left: -2rem;
				}
            }
            .suppi-foot {
				right: calc(100% - 2rem);
				transform: rotate(40deg);
				border-top-left-radius: 80% 70%;
				border-bottom-left-radius: 0.5rem 30%;
				border-top-right-radius: 20% 30%;
				border-bottom-right-radius: 1rem 70%;
                transform-origin: 90% 50%;
            }
            
        }
        &-right {
			left: calc(100% - 2rem);

			.suppi-foot {
				left: calc(100% - 2rem);
				transform: rotate(-40deg);
				border-top-right-radius: 80% 70%;
				border-bottom-right-radius: 0.5rem 30%;
				border-top-left-radius: 20% 30%;
				border-bottom-left-radius: 1rem 70%;
				transform-origin: 10% 50%;
			}

			.suppi-leg-upper {
				&::after {
					right: -2rem;
				}
			}
		}
    }
    &-tail{
        --tail-width: 1rem;
		--spiral-width: 2.5rem;
		--tail-transform: rotate(10deg);

		position: absolute;
		z-index: 0;
		bottom: 0.5rem;
		left: 50%;
		height: 10rem;
		width: 10rem;
		transform-origin: left bottom;
		transform: var(--tail-transform);
        &-length{
            @include absolute-fill;
            overflow: hidden;
            &::before {
				content: "";
				position: absolute;
				right: 0;
				bottom: 0;
				height: 15rem;
				width: 15rem;
				border-radius: 50%;
				border-right: var(--tail-width) solid var(--primary-color);
				border-bottom: var(--tail-width) solid var(--primary-color);
			}
        }
        &-spiral {
			position: absolute;
			height: var(--tail-width);
			width: var(--spiral-width);
			border-radius: 0.25rem;

			&-1,
			&-3,
			&-5 {
				transform-origin: bottom right;
			}

			&-2,
			&-4 {
				left: 0.5rem;
				transform-origin: bottom left;
				background-color: var(--primary-color-dark);

				&::after {
					@include absolute-fill(true);

					top: -0.325rem;
					left: -0.4375rem;
					border-radius: inherit;
					transform: rotate(40deg);
					transform-origin: inherit;
					background-color: var(--primary-color);
				}
			}

			&-1 {
				right: 0.35rem;
				transform: rotate(20deg);
			}

			&-2 {
				transform: rotate(-40deg);
			}

			&-3 {
				transform: rotate(30deg);
			}

			&-4 {
				transform: rotate(-40deg);
			}

			&-5 {
				transform: rotate(40deg);
				background-color: var(--primary-color);
			}
		}
    }

}
.sweets{
    --sweets-width: 4.5rem;

	position: absolute;
	z-index: 11;
	bottom: 0;
	left: calc(50% - (var(--sweets-width) / 2));
	height: var(--sweets-width);
	width: var(--sweets-width);
	transform: translateY(var(--sweets-translate, 0));
    border-radius: 50%;
    box-shadow: inset 0 -.5rem 0 var(--choco-dark),
                inset 0 0 0 1.75rem var(--choco);
    cursor: pointer;
    transition: transform 0.4s ease-in-out;
    &-shadow {
		position: absolute;
		z-index: 0;
		bottom: -0.25rem;
		height: 0.75rem;
		width: 3.5rem;
		transform: var(--sweets-shadow-scale, scale(1));
		border-radius: 50%;
		background-color: var(--shadow-color);
		transition: transform 0.4s ease-in-out;
    }
    &-control{
        position: absolute;
        opacity: 0;
        &:not(:checked) {
			+ .suppi {
				.suppi {
					&-eye {
						animation: blinky 7s infinite;
					}
				}

				.sweets {
					&:hover {
						~ .suppi-head {
							--eye-inner-top-radius: 0.75rem 1.5rem;
							--eye-inner-transform: translateY(0.5rem) scaleY(1.4);
							--eye-inner-transition: border-radius 0.1s, transform 0.15s ease-in-out;
						}
					}
				}
			}
		}

        &:checked {
            + .suppi{
                $delay : 1s;
                --eye-top: 5.5rem;
                --eye-top-radius: 50%;
                --eye-bottom-radius: 20% 30%;
                --eye-transition: border-radius 0.2s #{$delay} ease-in-out,
                    top 0.3s #{$delay} ease-in-out;
                --eye-inner-top-radius: 0.75rem 2rem;
                --eye-inner-transform: translateY(1rem) scaleY(1.3);
                --eye-inner-transition: 0.3s #{$delay} ease-in-out;
                --mouth-width: 2.25rem;
                --mouth-transtion: width 0.3s #{$delay} ease-in-out;
                --arm-left-translate: -0.75rem;
                --paw-rotate: -120deg;
                --blush-scale: 1.3;
                --blush-opacity: 0.4;
                --blush-transition: transform 0.5s #{$delay} ease-in-out,
                    opacity 0.5s #{$delay} ease-in-out;
                --sweets-translate: -5rem;
                --sweets-shadow-scale: scale(0.8) translateY(-1.2rem);
                
                .suppi{
                    &-ear-left {
						animation: earMoveLeft 0.8s $delay ease-in-out infinite;
                    }
                    &-ear-right {
						animation: earMoveRight 0.8s $delay ease-in-out infinite;
                    }
                    &-mouth-inner {
						animation: chomp 1.2s 0.5s ease-in-out forwards;
                    }
                    &-wing-left {
						animation: wingflapLeft 1.2s $delay ease-in-out infinite;
					}

					&-wing-right {
						animation: wingflapRight 1.2s $delay ease-in-out infinite;
                    }
                    &-tail {
						animation: tailFlip 2s $delay ease-in-out infinite;
					}
                }
            }
        }
       
    }
}

@keyframes blinky {
	0%,
	9%,
	11%,
	19%,
	21%,
	69%,
	71%,
	100% {
		transform: scaleY(1);
	}
	10%,
	20%,
	70% {
		transform: scaleY(0);
	}
}

@keyframes earMoveLeft {
	0%,
	100% {
		transform: rotate(var(--ear-transform));
	}
	50% {
		transform: rotate(15deg);
	}
}
@keyframes earMoveRight {
	0%,
	100% {
		transform: rotate(var(--ear-transform));
	}
	50% {
		transform: rotate(-15deg);
	}
}
@keyframes chomp {
	0%,
	40% {
		transform: scaleY(0);
	}
	20% {
		transform: scale(0.2);
	}
	100% {
		transform: scaleY(1);
	}
}

@keyframes wingflapLeft {
	0%,
	100% {
		transform: --wing-transform;
	}
	50% {
		transform: rotate(15deg);
	}
}
@keyframes wingflapRight {
	0%,
	100% {
		transform: --wing-transform;
	}
	50% {
		transform: rotate(-15deg) rotateY(180deg);
	}
}

@keyframes tailFlip {
	0%,
	100% {
		transform: var(--tail-transform);
	}
	50% {
		transform: rotate(-10deg) rotateY(180deg);
	}
}
